package com.bleeth.hvbox;

import com.bleeth.fx.helper.ControlsHelper;
import com.bleeth.fx.layout.FormBuilder;
import com.bleeth.fx.layout.GirdCell;
import javafx.application.Application;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;

public class LoginMain extends Application {
    @Override
    public void start(Stage stage) {
        show(stage);
    }

    public static void main(String[] args) {
        launch(args);
    }

    public static void show(Stage stage) {
        VBox loginForm = FormBuilder.form(400D, 300D)
                .addEmptyRow(10D)
                .addRow(GirdCell.createCell(1, Pos.CENTER))
                .addCell(0, ControlsHelper.createLabel("大数据管理平台","","h3"))
                .endRow(false)
                .addEmptyRow(50D)
                .addRow(
                        GirdCell.createCell(1, Pos.CENTER),
                        GirdCell.createCell(1, Pos.CENTER_RIGHT),
                        GirdCell.createCell(1, Pos.CENTER_LEFT),
                        GirdCell.createCell(1, Pos.CENTER)
                )
                .addCell(1, ControlsHelper.createLabel("用户名","","h5"))
                .coverCell(2, ControlsHelper.createTextField("","","","h5"))
                .endRow(false)
                .addEmptyRow(50D)
                .addRow(
                        GirdCell.createCell(1, Pos.CENTER),
                        GirdCell.createCell(1, Pos.CENTER_RIGHT),
                        GirdCell.createCell(1, Pos.CENTER_LEFT),
                        GirdCell.createCell(1, Pos.CENTER)
                )
                .addCell(1, ControlsHelper.createLabel("密  码","","h5"))
                .coverCell(2, ControlsHelper.createPasswordField(""))
                .endRow(false)
                .addEmptyRow(50D)
                .addRow(
                        GirdCell.createCell(1, Pos.CENTER),
                        GirdCell.createCell(1, Pos.CENTER,10D),
                        GirdCell.createCell(1, Pos.CENTER)
                )
                .addCell(1, ControlsHelper.createBtn("确认","btn-info","h5"))
                .addCell(1, ControlsHelper.createBtn("取消","btn-info","h5"))
                .endRow(false)
                .build();
        loginForm.setStyle(ControlsHelper.randomBgColor());


        VBox root = FormBuilder.form(Pos.CENTER)
                .addRow(GirdCell.createCell(1, Pos.CENTER))
                .addCell(0, loginForm)
                .endRow(false)
                .build();

        root.setStyle(ControlsHelper.randomBgColor());
        Scene scene = new Scene(root, 800, 600);
        root.prefHeightProperty().bind(scene.heightProperty());
        root.prefWidthProperty().bind(scene.widthProperty());
        stage.setScene(scene);
        stage.show();
    }


}
